/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package interfaz.plantillas;

import entidades.miembros.Socio;
import exceptions.ValoresIncompletosException;
import exceptions.ValoresIncorrectosException;
import interfaces.PlantillaRegistro;
import javax.swing.BoxLayout;
import javax.swing.JPanel;
/**
 *
 * @author fcarou
 */
public class PlantillaSocio extends javax.swing.JPanel implements PlantillaRegistro
{
    private Socio socio;
    
    private PlantillaDatosPersonales datosPersonales;
    private PlantillaDatosInstitucionales datosInstitucionales;
    private PlantillaDomicilio domicilio;
    
    /**
     * Creates new form PlantillaSocio
     * @param socio
     */
    public PlantillaSocio(Socio socio)
    {
        this.socio = socio;
        
        initComponents();
        
        setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
        setUp();
    }
    
    private void setUp ()
    {
        datosPersonales = new PlantillaDatosPersonales(socio.getDatosPersonales());
        add(datosPersonales);
        
        JPanel panelCentro = new JPanel();
        panelCentro.setLayout(new BoxLayout(panelCentro, BoxLayout.Y_AXIS));
        
        datosInstitucionales = new PlantillaDatosInstitucionales(socio.getDatosInstitucionales());
        panelCentro.add(datosInstitucionales);
        
        domicilio = new PlantillaDomicilio(socio.getDomicilio());
        panelCentro.add(domicilio);
        
        add(panelCentro);
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents()
    {

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 439, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 279, Short.MAX_VALUE)
        );
    }// </editor-fold>//GEN-END:initComponents


    // Variables declaration - do not modify//GEN-BEGIN:variables
    // End of variables declaration//GEN-END:variables

    @Override
    public Object getDato() throws ValoresIncorrectosException, ValoresIncompletosException
    {
        datosInstitucionales.getDato();
        datosPersonales.getDato();
        domicilio.getDato();
        
        return socio;
    }
}
